package cn.edu.cqu.bysj.wm.gui.component;

import java.awt.BorderLayout;

import cn.edu.cqu.bysj.wm.gui.model.AlgorithmConfig;
import cn.edu.cqu.bysj.wm.gui.result.GNAlgorithmResult;
import cn.edu.cqu.bysj.wm.gui.table.CommunityView;
import cn.edu.cqu.bysj.wm.gui.table.DepthQView;

public class GNSQAlgorithmTabPane extends AlgorithmTabPane {
	GNSQResultContent content = new GNSQResultContent();

	/**
	 * create gn algorithm tab
	 * 
	 * @param _title
	 * @param _configure
	 */
	public GNSQAlgorithmTabPane(String _title, AlgorithmConfig _configure) {
		super(1, _title, _configure);
		setLayout(new BorderLayout(0, 0));

		splitPane.setLeftComponent(content);
		splitPane.setDividerSize(0);
		add(splitPane);
	}

	public void showResult() {
		// community detection result
		CommunityView cView1 = new CommunityView("社区发现结果一览", 10);
		cView1.initDatas(result.getCommunityRows());
		content.getCommunityRows().add(cView1, BorderLayout.CENTER);

		// all depths and Q value
		DepthQView cView2 = new DepthQView("深度与Q值一览");
		GNAlgorithmResult tempResult = (GNAlgorithmResult) result;
		cView2.initDatas(tempResult.getDepthQRows());
		content.getDepthQRows().add(cView2, BorderLayout.CENTER);
		content.getInitialTime().setText(tempResult.getInitTime() + "");
		content.getIterationTime().setText(tempResult.getIterTime() + "");
		content.getTotalTime().setText(tempResult.getTotalTime() + "");
		content.getCalculateBetweenessTime()
				.setText(tempResult.getbTime() + "");
		content.getTotalDepth().setText(tempResult.getDepth() + "");
		content.getMaxDepth().setText(tempResult.getMaxDepth() + "");
		content.getMaxQValue().setText(tempResult.getMaxQ() + "");

	}
}
